<?php
	class filevanbandb
	{
		public function Add($MaVanBanDen, $MaVanBanDi, $Path, $TenFileVanBan)
		{
			$sql = " INSERT INTO `tbl_filevanban`( `MaVanBanDen`, `MaVanBanDi`, `Path`, `TenFileVanBan`) VALUES ('$MaVanBanDen', '$MaVanBanDi', '$Path', '$TenFileVanBan')";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function DeleteVanBanDen($MaVanBanDen)
		{
			$sql = " DELETE FROM `tbl_filevanban` WHERE MaVanBanDen = '$MaVanBanDen' ";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}	
		
		public function DeleteVanBanDi($MaVanBanDi)
		{
			$sql = " DELETE FROM `tbl_filevanban` WHERE MaVanBanDi = '$MaVanBanDi' ";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}		
		
		public function GetList($MaFileVanBan, $MaVanBanDen, $MaVanBanDi, $TenFileVanBan)
		{
			$sql = " SELECT * FROM `tbl_filevanban` WHERE 1 ";
			
			if($MaFileVanBan != "")
				$sql .= " AND MaFileVanBan = '$MaFileVanBan' ";
			if($MaVanBanDen != "")
				$sql .= " AND MaVanBanDen = '$MaVanBanDen' ";
			if($MaVanBanDi != "")
				$sql .= " AND MaVanBanDi = '$MaVanBanDi' ";
			if($TenFileVanBan != "")
				$sql .= " AND TenFileVanBan LIKE '%$TenFileVanBan%' ";
				
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		
	
	}
?>